
<html lang="en" class="h-100">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>DRMS Register</title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="./images/favicon.png">
    <link href="./css/style.css" rel="stylesheet">

</head>

<body class="h-100">
    <div class="authincation h-100">
        <div class="container h-100">
            <div class="row justify-content-center h-100 align-items-center">
                <div class="col-md-6">
                    <div class="authincation-content">
                        <div class="row no-gutters">
                            <div class="col-xl-12">
                                <div class="auth-form">
                                    <h4 class="text-center mb-4">注册</h4>
                                    <form action="/DRMS/RegisterServlet" method="post">
                                        <div class="form-group">
                                            <label class="mb-1"><strong>用户名</strong></label>
                                            <input type="text" class="form-control" name="uid" id="uid">
                                        </div>
                                        <!---<div class="form-group">
                                            <label class="mb-1"><strong>邮箱</strong></label>
                                            <input type="email" class="form-control"name="email">
                                        </div>--->
                                        <div class="form-group">
                                            <label class="mb-1"><strong>密码</strong></label>
                                            <input type="password" class="form-control" id="pwd">
                                        </div>
                                        <div class="form-group">
                                            <label class="mb-1"><strong>确认密码</strong></label>
                                            <input type="password" class="form-control" id="repwd">
                                        </div>
                                            <input type="hidden" name="pwdHash" id="pwdHash">
                                        <div class="text-center mt-4">
                                            <input type="submit" class="btn btn-primary btn-block" id="submit" value="注册" onclick="return check()"></input>
                                        </div>
                                    </form>
                                    <div class="new-account mt-3">
                                        <p>已有账户？ <a class="text-primary" href="login.html">登录</a></p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

<!--**********************************
	Scripts
***********************************-->
<!-- Required vendors -->
<script src="./vendor/global/global.min.js"></script>
<script src="./vendor/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<script src="./js/custom.min.js"></script>
<script src="./js/deznav-init.js"></script>
<script src="./crypto-js-4.0.0/crypto-js.js"></script>
<script type="text/javascript">
    function check() {
        var uid=document.getElementById("uid").value;
        var pwd = document.getElementById("pwd").value;
        var repwd = document.getElementById("repwd").value;
        // 加密
        document.getElementById("pwdHash").value = CryptoJS.SHA256(document.getElementById("pwd").value);
        if(uid === "" || uid == null) {
            window.alert("用户名不能为空!");
            return false;
        }else if(pwd === "" || pwd == null) {
            window.alert("密码不能为空!");
            return false;
        }else if(!(pwd === repwd)) {
            window.alert("两次输入密码不一致！");
            return false;
        }
        return true;
    }

    /*function checkByJQueryPost() {
        var uid = $("#uid").val();
        var uidspan = $("#uidspan");
        if(uid == null || uid == "") {
            uidspan.css("color","yellow").html("用户名不能为空！");
        }else {
            $.post("/DRMS/CheckUidWithAjax",{"uid":uid},function (result){
               if(result == "true") {
                   uidspan.css("color","green").html("√");
               } else {
                   uidspan.css("color","red").html("用户名已经存在");
               }
            });
        }
    }*/
</script>

</body>
</html>